dcmotor32 2.2.0
Loading...
Searching...
No Matches
dcmotor32.h File Reference

This file contains API for DC Motor 32 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_analog_in.h"

Go to the source code of this file.

Data Structures

struct  dcmotor32_t
 DC Motor 32 Click context object. More...
struct  dcmotor32_cfg_t
 DC Motor 32 Click configuration object. More...

Macros

#define DCMOTOR32_CONTROL_SDO_SEL_CONTROL   0x00
 DC Motor 32 control byte setting.
#define DCMOTOR32_CONTROL_SDO_SEL_STATUS   0x80
#define DCMOTOR32_CONTROL_SDO_SEL_MASK   0x80
#define DCMOTOR32_CONTROL_MODE_PD_GND_OUT   0x00
#define DCMOTOR32_CONTROL_MODE_PU_SHORT_TO_GND   0x08
#define DCMOTOR32_CONTROL_MODE_SLOW_DECAY_LSB   0x10
#define DCMOTOR32_CONTROL_MODE_SLOW_DECAY_LSA   0x18
#define DCMOTOR32_CONTROL_MODE_FAST_DECAY_HSB   0x20
#define DCMOTOR32_CONTROL_MODE_FAST_DECAY_HSB_OPEN_LOAD   0x28
#define DCMOTOR32_CONTROL_MODE_FORWARD_HSB   0x30
#define DCMOTOR32_CONTROL_MODE_FORWARD_LSA   0x38
#define DCMOTOR32_CONTROL_MODE_FAST_DECAY_HSA_OPEN_LOAD   0x40
#define DCMOTOR32_CONTROL_MODE_FAST_DECAY_HSA   0x48
#define DCMOTOR32_CONTROL_MODE_REVERSE_LSB   0x50
#define DCMOTOR32_CONTROL_MODE_REVERSE_HSA   0x58
#define DCMOTOR32_CONTROL_MODE_SLOW_DECAY_HSB   0x60
#define DCMOTOR32_CONTROL_MODE_SLOW_DECAY_HSA   0x68
#define DCMOTOR32_CONTROL_MODE_HALF_BRIDGE_A_TRI_STATE   0x70
#define DCMOTOR32_CONTROL_MODE_HALF_BRIDGE_B_TRI_STATE   0x78
#define DCMOTOR32_CONTROL_MODE_MASK   0x78
#define DCMOTOR32_CONTROL_CURRENT_SENSE_DISABLE   0x00
#define DCMOTOR32_CONTROL_CURRENT_SENSE_ENABLE   0x04
#define DCMOTOR32_CONTROL_CURRENT_SENSE_MASK   0x04
#define DCMOTOR32_CONTROL_SLEW_RATE_SLOW   0x00
#define DCMOTOR32_CONTROL_SLEW_RATE_FAST   0x02
#define DCMOTOR32_CONTROL_SLEW_RATE_MASK   0x02
#define DCMOTOR32_CONTROL_EN_DISABLE   0x00
#define DCMOTOR32_CONTROL_EN_ENABLE   0x01
#define DCMOTOR32_CONTROL_EN_MASK   0x01
#define DCMOTOR32_STATUS_SDO_SEL_CONTROL   0x00
 DC Motor 32 status byte setting.
#define DCMOTOR32_STATUS_SDO_SEL_STATUS   0x80
#define DCMOTOR32_STATUS_SDO_SEL_MASK   0x80
#define DCMOTOR32_STATUS_OCA_MASK   0x40
#define DCMOTOR32_STATUS_OCB_MASK   0x20
#define DCMOTOR32_STATUS_OL_MASK   0x10
#define DCMOTOR32_STATUS_UV_MASK   0x08
#define DCMOTOR32_STATUS_TSDA_MASK   0x04
#define DCMOTOR32_STATUS_TSDB_MASK   0x02
#define DCMOTOR32_STATUS_EN_MASK   0x01
#define DCMOTOR32_R8   1000.0
 DC Motor 32 current calculation setting.
#define DCMOTOR32_R9   820.0
#define DCMOTOR32_NUM_CONVERSIONS   200
 DC Motor 32 default ADC samples number for averaging.
#define DCMOTOR32_VREF_3V3   3.3
 DC Motor 32 ADC setting.
#define DCMOTOR32_VREF_5V   5.0
#define DCMOTOR32_VREF_DEFAULT   DCMOTOR32_VREF_3V3
#define DCMOTOR32_TIMEOUT_MS   2000
 DC Motor 32 timeout setting.
#define DCMOTOR32_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.

Enumerations

enum  dcmotor32_return_value_t { DCMOTOR32_OK = 0 , DCMOTOR32_ERROR = -1 }
 DC Motor 32 Click return value data. More...

Functions

void dcmotor32_cfg_setup (dcmotor32_cfg_t *cfg)
 DC Motor 32 configuration object setup function.
err_t dcmotor32_init (dcmotor32_t *ctx, dcmotor32_cfg_t *cfg)
 DC Motor 32 initialization function.
err_t dcmotor32_default_cfg (dcmotor32_t *ctx)
 DC Motor 32 default configuration function.
err_t dcmotor32_set_control (dcmotor32_t *ctx, uint8_t control)
 DC Motor 32 set control function.
err_t dcmotor32_get_status (dcmotor32_t *ctx)
 DC Motor 32 get status function.
err_t dcmotor32_set_operation_mode (dcmotor32_t *ctx, uint8_t mode)
 DC Motor 32 set operation mode function.
err_t dcmotor32_enable_isense (dcmotor32_t *ctx)
 DC Motor 32 enable current sense function.
err_t dcmotor32_disable_isense (dcmotor32_t *ctx)
 DC Motor 32 disable current sense function.
err_t dcmotor32_set_fast_slew_rate (dcmotor32_t *ctx)
 DC Motor 32 set fast slew rate function.
err_t dcmotor32_set_slow_slew_rate (dcmotor32_t *ctx)
 DC Motor 32 set slow slew rate function.
err_t dcmotor32_enable_device (dcmotor32_t *ctx)
 DC Motor 32 enable device function.
err_t dcmotor32_disable_device (dcmotor32_t *ctx)
 DC Motor 32 disable device function.
err_t dcmotor32_read_adc_raw (dcmotor32_t *ctx, uint16_t *data_out)
 DC Motor 32 read raw IS ADC value function.
err_t dcmotor32_read_adc_volt (dcmotor32_t *ctx, float *data_out)
 DC Motor 32 read IS pin voltage level function.
err_t dcmotor32_read_adc_volt_avg (dcmotor32_t *ctx, uint16_t num_conv, float *volt_avg)
 DC Motor 32 read IS pin voltage level average function.
err_t dcmotor32_set_adc_vref (dcmotor32_t *ctx, float vref)
 DC Motor 32 set vref function.
err_t dcmotor32_calib_offset (dcmotor32_t *ctx)
 DC Motor 32 calibrate offset function.
err_t dcmotor32_get_out_current (dcmotor32_t *ctx, float *current)
 DC Motor 32 get output current function.

Detailed Description

This file contains API for DC Motor 32 Click Driver.

Enumeration Type Documentation

◆ dcmotor32_return_value_t

DC Motor 32 Click return value data.

Predefined enum values for driver return values.

Enumerator
DCMOTOR32_OK 
DCMOTOR32_ERROR